$('.banner-box').slick({
  autoplay: true,
  pauseOnDotsHover: true,
  prevArrow: $('.prev'),
  nextArrow: $('.next')
});

// 点击切换产品分类
for(let i = 0; i < tabs.length; i ++){
  $(".steel-tab").append(`<li>${tabs[i].cate}</li>`)
  var $child = $('.right-box').append(`<div class="right-list fa wrap"></div>`).children().last()
  for(var j = 0; j < tabs[i].show.length; j ++){
    $child.append(`<div class="img" data-title="${tabs[i].show[j].title}">
      <img src="${tabs[i].show[j].imgUrl}" alt="">
    </div>`)
  }
}

$('.right-box').children().first().addClass('show')

$('.steel-tab li').click(function (){
  console.log($(this).index())
  let i = $(this).index()
  $('.right-box').children(':eq('+i+')').addClass('show').siblings('.show').removeClass('show')
})

window.onscroll = throttle(e => {
  let sct = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop || 0;
  if(sct > 900){
    $(".toTop").addClass('show')
  }else {
    $(".toTop").removeClass('show')
  }
}, 600)

function throttle(fn, wait){
  let timer = null
  return e => {
    if(!timer){
      timer = setTimeout(() => {
        fn(e)
        timer = null
      }, wait)
    }
  }
}